import request from '@/utils/request'
import type { TagPage, Tag } from '@/api/types/tag'

export const pageList = (params: {
  current: number,
  size: number,
  name?: string
}) => {
  return request<TagPage>({
    method: 'get',
    url: '/admin/tag/page',
    params
  })
}

export const add = (data: Tag) => {
  return request<boolean>({
    method: 'post',
    url: '/admin/tag',
    data
  })
}

export const deleteByIds = (ids: number[]) => {
  return request<boolean>({
    method: 'delete',
    url: '/admin/tag/' + String(ids)
  })
}

export const getTagList = () => {
  return request<Tag[]>({
    method: 'get',
    url: '/admin/tag/list'
  })
}